<template>
	<view class="Myessay">

		<view class="total-text" v-for="(item,index) in testbar " :key="index">
			<!-- 左方图片区域 -->
			<view class="left-img">
				<image src="https://warmstill-1314066575.cos.ap-chengdu.myqcloud.com/warmstill/2022/11/10/95a0d0b3-6e9e-4e53-9fbe-b5fb3d4f8f2cimage/jpg" ></image>
			</view>
			<!-- 右方文字区域 -->
			<view class="right-textra">
				<!-- 标题 -->
				<text class="first-t" >{{item.name}}</text>
				<!-- 文章 -->
				<view>
					<text>
						{{item.standard.slice(0,30)+'...'}}
					</text>
					<text>
						（{{item.scoring_criteria}})
					</text>
					<!-- 测试标题 -->
					<view class="totest">
						<text @click="golead(index)">立即测试</text>
					</view>
				</view>
			</view>
			<!--  -->
		</view>
	</view>
</template>

<script>
	export default {
		name: "Mytest",
		data() {
			return {
				testbar: {},
			};
		},
		mounted() {
			this.getTestbar();
		},
		methods: {
			golead(index) {
				uni.navigateTo({
					url: '/pages/TestLead/TestLead?index='+index
				})
			},
			async getTestbar(){
				let res = await this.$store.dispatch("getTestBar");
				// console.log(res);
				if(res=="ok"){
					this.testbar = this.$store.state.test.testbar;
					console.log("this.testbar",this.testbar);
				}
			}
		}
	}
</script>

<style lang="scss" scoped>
	.Myessay {
		width: 750rpx;
		height: auto;
		display: flex;
		flex-direction: column;

		.total-text {
			width: 750rpx;
			// min-height: 400rpx;
			height: auto;
			display: flex;
			padding-bottom: 40rpx;
			border-bottom: 1px solid #ccc;
			margin-bottom: 30rpx;

			.left-img {
				width: 280rpx;
				height: 250rpx;
				margin-left: 30rpx;
				margin-right: 30rpx;

				image {
					width: 100%;
					height: 100%;
					border-radius: 25rpx;
				}
			}

			.right-textra {
				width: 340rpx;
				height: auto;
				position: relative;

				.first-t {
					font-weight: 600;
					font-size: 35rpx;
				}

				view {
					margin-top: 20rpx;
					width: 400rpx;
					line-height: 50rpx;
					font-size: 30rpx;
					
					text {
						display: block;
					}


					.text-title {
						width: 150rpx;
						height: 50rpx;
						border-radius: 10px;
						line-height: 50rpx;
						text-align: center;
						// position: absolute;
						margin-left: 210rpx;
						color: #f3f3f3;
						font-size: 28rpx;
						margin-top: 15rpx;
						background-color: #dc5a5a;
					}
					
					.totest {
						width: 150rpx;
						height: 50rpx;
						border-radius: 10px;
						line-height: 50rpx;
						text-align: center;
						// position: absolute;
						margin-left: 210rpx;
						color: #f3f3f3;
						font-size: 28rpx;
						margin-bottom: 0rpx;
						background-color: #dc5a5a;
					}

					// 
					.paise {
						width: 300rpx;
						height: 100rpx;
						margin-left: 100rpx;
						// background-color: #dc5a5a;
						display: flex;

						.first-child {
							width: 140rpx;
							display: flex;
							align-items: center;
							justify-content: center;
							// background-color: #dc5a5a;
						}
					}
				}


			}

			// 

		}
	}
</style>
